#ifndef __NANDFLASH_H__
#define __NANDFLASH_H__

#define FLASH_PAGESIZE 0x800 // 2KB
#define FLASH_PAGESOFBLOCK_SHIFT 6 // 64pages (128KB) for a block
#define FLASH_PAGESOFBLOCK (1 << 6)
#define FLASH_BLOCKSIZE (FLASH_PAGESIZE * FLASH_PAGESOFBLOCK)

void NF_Init(void);
void NF_Reset(void);

int NF_EraseBlock(U32 blockNum);
int NF_ReadPage(U32 block,U32 page,U8 *buffer);
int NF_WritePage(U32 block,U32 page,U8 *buffer);
int NF_IsBadBlock(U32 block);

int Do_ReadKernel(unsigned char *pDst, unsigned long offset, unsigned long len);
int Do_WriteKernel(unsigned char *pSrc, unsigned long offset, unsigned long len);

#endif // __NANDFLASH_H__
